/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author BATAQUERO
 */
@Entity
@Table(name = "convenio_x_periodo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ConvenioXPeriodo.findAll", query = "SELECT c FROM ConvenioXPeriodo c"),
    @NamedQuery(name = "ConvenioXPeriodo.findByIdConvenioPeriodo", query = "SELECT c FROM ConvenioXPeriodo c WHERE c.idConvenioPeriodo = :idConvenioPeriodo"),
    @NamedQuery(name = "ConvenioXPeriodo.findByMaxId", query = "SELECT max(c.idConvenioPeriodo) FROM ConvenioXPeriodo c"),
    @NamedQuery(name = "ConvenioXPeriodo.findByidSupervisorIdPeriodo", query = "SELECT c FROM ConvenioXPeriodo c WHERE c.idSupervisor = :idSupervisor AND c.idPeriodo = :idPeriodo")})
public class ConvenioXPeriodo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idConvenioPeriodo")
    private Integer idConvenioPeriodo;
    @JoinColumn(name = "idSupervisorEntidad", referencedColumnName = "idSupervisorEntidad")
    @ManyToOne(optional = false)
    private SupervisorEntidad idSupervisorEntidad;
    @JoinColumn(name = "idSupervisor", referencedColumnName = "idSupervisor")
    @ManyToOne(optional = false)
    private Supervisor idSupervisor;
    @JoinColumn(name = "idPeriodo", referencedColumnName = "idPeriodo")
    @ManyToOne(optional = false)
    private Periodo idPeriodo;
    @JoinColumn(name = "idArea", referencedColumnName = "idArea")
    @ManyToOne(optional = false)
    private Area idArea;
    @JoinColumn(name = "idConvenio", referencedColumnName = "idConvenio")
    @ManyToOne(optional = false)
    private Convenio idConvenio;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "convenioXPeriodo")
    private List<ConvenioXPeriodoXEstudiante> convenioXPeriodoXEstudianteList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idConvenioPeriodo")
    private List<Observacionesconvenioperiodo> observacionesconvenioperiodoList;

    public ConvenioXPeriodo() {
    }

    public ConvenioXPeriodo(Integer idConvenioPeriodo) {
        this.idConvenioPeriodo = idConvenioPeriodo;
    }

    public Integer getIdConvenioPeriodo() {
        return idConvenioPeriodo;
    }

    public void setIdConvenioPeriodo(Integer idConvenioPeriodo) {
        this.idConvenioPeriodo = idConvenioPeriodo;
    }

    public SupervisorEntidad getIdSupervisorEntidad() {
        return idSupervisorEntidad;
    }

    public void setIdSupervisorEntidad(SupervisorEntidad idSupervisorEntidad) {
        this.idSupervisorEntidad = idSupervisorEntidad;
    }

    public Supervisor getIdSupervisor() {
        return idSupervisor;
    }

    public void setIdSupervisor(Supervisor idSupervisor) {
        this.idSupervisor = idSupervisor;
    }

    public Periodo getIdPeriodo() {
        return idPeriodo;
    }

    public void setIdPeriodo(Periodo idPeriodo) {
        this.idPeriodo = idPeriodo;
    }

    public Area getIdArea() {
        return idArea;
    }

    public void setIdArea(Area idArea) {
        this.idArea = idArea;
    }

    public Convenio getIdConvenio() {
        return idConvenio;
    }

    public void setIdConvenio(Convenio idConvenio) {
        this.idConvenio = idConvenio;
    }

    @XmlTransient
    public List<ConvenioXPeriodoXEstudiante> getConvenioXPeriodoXEstudianteList() {
        return convenioXPeriodoXEstudianteList;
    }

    public void setConvenioXPeriodoXEstudianteList(List<ConvenioXPeriodoXEstudiante> convenioXPeriodoXEstudianteList) {
        this.convenioXPeriodoXEstudianteList = convenioXPeriodoXEstudianteList;
    }

    @XmlTransient
    public List<Observacionesconvenioperiodo> getObservacionesconvenioperiodoList() {
        return observacionesconvenioperiodoList;
    }

    public void setObservacionesconvenioperiodoList(List<Observacionesconvenioperiodo> observacionesconvenioperiodoList) {
        this.observacionesconvenioperiodoList = observacionesconvenioperiodoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idConvenioPeriodo != null ? idConvenioPeriodo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ConvenioXPeriodo)) {
            return false;
        }
        ConvenioXPeriodo other = (ConvenioXPeriodo) object;
        if ((this.idConvenioPeriodo == null && other.idConvenioPeriodo != null) || (this.idConvenioPeriodo != null && !this.idConvenioPeriodo.equals(other.idConvenioPeriodo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.ConvenioXPeriodo[ idConvenioPeriodo=" + idConvenioPeriodo + " ]";
    }
    
}
